/**
 * Created by win7 on 2016/4/13.
 */
define(['jquery','store'],function($,store){
    function start(token){
        var token=token||store.get('token');
        if(token){
            store.set('token',token);
            $.ajaxSetup({
                headers: {
                    'authorization':'Bearer '+token
                }
            });
        }
    }
    start();
    function clear(){
        store.remove('token');
        $.ajaxSetup({
            headers: {
                'authorization':''
            }
        });
    }
    return {
        start:start,
        clear:clear
    }
})

